Back to index |
Fire is one of the simplest effects that you can do that also looks great.
First of all if you are in mode 13h you need to setup the palette. It should start as black, then go to red, then yellow and on to white. Then put one or two horizontal lines of random pixels at the bottom of the screen. To make the fire move begin at the pixel just above the random lines and get the average color of the surrounding pixels. I did it like this in the sample program
x = (a + c) / 2 + (b + x) / 2 If you have one random line start at offset 320 and move your way up to 63999 calculating each pixel like this. Then start all over again at offset 320. The sample program uses a virtual screen and waits for the screen to update before copying the virtual screen to the screen memory.
Here is a screen shot from the sample program
Here is a sample program
|
Jesper L. Poulsen |